<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>java</title>
    <link rel="stylesheet" href="/css/style.css"/>
</head>
<body>
    <div class="n-support">请使用Chrome、Safari等webkit内核的浏览器！</div>
    <div class="n-head">
        <div class="g-doc f-cb">
            <#if flag == 1>
                <div class="user">
                    卖家你好，<span class="name">seller</span>！<a href="/logout">[退出]</a>
                </div>
                <ul class="nav">
                    <li><a href="/api/sellerindex">首页</a></li>
                    <li><a href="/api/public">发布</a></li>
                </ul>
            <#elseif flag == 2>
                 <div class="user">
                    买家你好,buyer! <a href="/logout">[退出]</a>
                 </div>
                <ul class="nav">
                    <li><a href="/api/buyerindex">首页</a></li>
                    <li><a href="/api/toAccount">账务</a></li>
                    <li><a href="/api/toSettleAccount">购物车</a></li>
                </ul>
            <#else>
                <div class="user">
                    请<a href="/toLogin">[登录]</a>
                </div>
                <ul class="nav">
                    <li><a href="/">首页</a></li>
                </ul>
            </#if>
        </div>
    </div>
    <div class="g-doc">
        <div class="n-show f-cb" id="showContent">
            <div class="img"><img src=${picture} alt="" ></div>
            <div class="cnt">
                <h2>${title}</h2>
                <p class="summary">${summary}</p>
                <div class="price">
                    <span class="v-unit">¥</span><span class="v-value">${price}</span>
                </div>
                <#if flag == 1>  <#--卖家登录-->
                    <div class="num">购买数量：<span id="plusNum" class="lessNum"></span><span class="totalNum" id="allNum">${buyNum}</span></div>
                    <div class="oprt f-cb">
                        <a href="/api/edit?id=${id}" class="u-btn u-btn-primary">编 辑</a>
                    </div>
                <#elseif flag == 2>   <#--买家登录-->
                    <#if isSell == 0>   <#--未购买、可以进行购买-->
                        <form action="/api/buy?id=${id}" method="post">
                            购买数量：<input type="number" name="buyNum" min="1"/>
                            <button type="submit" style="background-color: red;color: white" onclick="javascript:return show_confirm()">加入购物车</button>
                        </form>
                    <#else>    <#--已购买、不可进行购买-->
                        <div class="num">购买数量：<span id="plusNum" class="lessNum"></span><span class="totalNum" id="allNum">${buyNum}</span></div>
                        <div class="oprt f-cb">
                            <span class="u-btn u-btn-primary z-dis">已购买</span>
                            <span class="buyprice">当时购买价格：¥${buyPrice}</span>
                        </div>
                    </#if>
                <#else>      <#--未登录-->
                    <div class="num">购买数量：<span id="plusNum" class="lessNum"></span><span class="totalNum" id="allNum">${buyNum}</span></div>
                </#if>

            </div>
        </div>
        <div class="m-tab m-tab-fw m-tab-simple f-cb">
            <h2>详细信息</h2>
        </div>
        <div class="n-detail">
            ${detail}
        </div>
    </div>

    <div class="n-foot">
        <p>版权所有：网易云课堂<a href="http://mooc.study.163.com/smartSpec/detail/85002.htm">Java开发工程师(Web方向)</a>微专业团队</p>
    </div><script type="text/javascript" src="/js/global.js"></script>
    <script type="text/javascript" src="/js/pageShow.js"></script>
    <script type="text/javascript">
        function show_confirm()
        {
            var msg = "请确认是否添加购物车？\n\n请确认！";
            if (confirm(msg)==true)
            {
                return true;
            }
            else
            {
                return  false;
            }
        }
    </script>





</body>
</html>